package com.aikon.wht.reflect;

import com.sun.tracing.dtrace.ModuleName;
import jdk.nashorn.internal.objects.annotations.Getter;

import java.lang.annotation.Native;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.ParameterizedType;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author haitao.wang
 */
public class ReflectModel<T extends Number,S> {

    @Annotation1(ann1 = "234234")
    @Native
    List<? extends FieldEnum> f1;

    private String f2;

    public static Enum f3 = FieldEnum.e1;

    T f4;

    Map.Entry<T,S> f5;

    S[] f6;

    Class f7;



    public Class getF7() {
        System.out.println(getClass().getGenericSuperclass());
//        return  (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
        return null;
    }


    public <V> Map.Entry<T, S> method1(@Annotation1(ann1 = "this is ann1 for arg1") @Annotation2(ann2 = "this is ann2 for arg1") Collection<T> arg1, @Annotation1(ann1 = "this is ann1 for arg2") S arg2) {
        V v;
        return new Map.Entry<T, S>() {
            @Override
            public T getKey() {
                return null;
            }

            @Override
            public S getValue() {
                return null;
            }

            @Override
            public S setValue(S value) {
                return null;
            }
        };
    }



    @Override
    public String toString() {
        return "ReflectModel{" +
                "f1=" + f1 +
                ", f2='" + f2 + '\'' +
                '}';
    }

    public enum FieldEnum{
        e1(1),
        e2(2),
        ;

        int code;

        FieldEnum(int code) {
            this.code = code;
        }
    }
}
